package com.bigmodel.util;

import cn.hutool.core.util.RandomUtil;
import com.bigmodel.entity.TimeEntity;
import com.bigmodel.qa.timedata.TimeDataConstant;
import lombok.extern.slf4j.Slf4j;

import java.time.DayOfWeek;
import java.time.LocalDateTime;
import java.time.temporal.TemporalAdjusters;
import java.util.*;

/**
 * @Author: shukai.chen
 * @CreateTime: 2024-01-20 10:12
 */

@Slf4j
public class TimeUtils {
    private static final int randomNumber = 20;

    // 下周五上午10点38分身份证43031319810511958X，
    // {
    //"identityCard": "43031319810511958X",
    //"startTime": "LocalDateTime.now().with(TemporalAdjusters.next(DayOfWeek.FRIDAY)).withHour(10).withMinute(38);"
    //}
    public static void main(String[] args) {
        LocalDateTime thisTuesdayAt4_05 =
                LocalDateTime.now().with(TemporalAdjusters.next(DayOfWeek.FRIDAY)).withHour(10).withMinute(38);
        System.out.println(thisTuesdayAt4_05);

    }

    // 第一个%s代表今天开始往后几天，如1代表明天；第二个%s代表时；第三个%s代表分
    private static final String TIME_TEMPLATE_ONE =
            "LocalDateTime.now().plusDays(%s).toLocalDate().atTime(%s,%s);";
    // 本周：前三个%s代表本周几；第四个%s代表时；第五个%s代表分
    private static final String TIME_TEMPLATE_TWO =
            "LocalDateTime.now().with(%s).toLocalDate().atTime(%s,%s);";
    // 下周：第一个%s代表下周几；第二个%s代表时，第三个%s代表分
    private static final String TIME_TEMPLATE_THREE = "LocalDateTime.now().plusWeeks(1).with(%s).toLocalDate().atTime(%s,%s);";

    /**
     * 提取时间 今天15点、明天14点12，大后天9点
     */
    public static Map<String, TimeEntity> T001() {

        Map<String, TimeEntity> timeEntityMap = new HashMap<>();
        Object[][] dateDescriptors = new Object[][]{{"", 0}, {"明天", 1}, {"今天", 0}, {"后天", 2}, {"大后天", 3}};
        for (Object[] dateDescriptor : dateDescriptors) {
            String dateDescriptorName = (String) dateDescriptor[0];
            int startDayStep = (int) dateDescriptor[1];
            for (int i = 0; i < randomNumber; i++) {
                int hour = RandomUtil.randomInt(0, 23);
                int min = RandomUtil.randomInt(0, 59);

                // 明天9点， 后天9点15。 大后天9点15分和大后天9点15属于一个类别
                {
                    String starttimeStr = null;
                    if (min == 0) {
                        starttimeStr = dateDescriptorName + getNumber(hour) + "点";
                    } else {
                        starttimeStr = dateDescriptorName + getNumber(hour) + "点" + getNumber(min);
                        int minStr = RandomUtil.randomInt(0, 2);
                        if (minStr == 1) {
                            starttimeStr += "分";
                        }
                    }
                    timeEntityMap.put(starttimeStr, TimeEntity.builder()
                            .other(starttimeStr)
                            .timeTemplate(String.format(TIME_TEMPLATE_ONE, startDayStep, hour, min)).build());
                }

                // 明天9点
                {
                    Map<String, Object> map = new HashMap<>();
                    String starttimeStr = dateDescriptorName + getNumber(hour) + "点";
                    timeEntityMap.put(starttimeStr, TimeEntity.builder()
                            .other(starttimeStr)
                            .timeTemplate(String.format(TIME_TEMPLATE_ONE, startDayStep, hour, 0)).build());
                }

                // 9点过5分
                {
                    String starttimeStr = null;
                    if (min >= 0) {
                        starttimeStr = dateDescriptorName + getNumber(hour) + "点半";
                        timeEntityMap.put(starttimeStr, TimeEntity.builder()
                                .other(starttimeStr)
                                .timeTemplate(String.format(TIME_TEMPLATE_ONE, startDayStep, hour, 30)).build());
                    }
                }


            }
        }

        return randomMap(timeEntityMap);
    }

    /**
     * 早上1点，上午2点，下午3点，今天4点
     *
     * @return
     */
    public static Map<String, TimeEntity> T002() {

        Map<String, TimeEntity> timeEntityMap = new HashMap<>();

        // 早上几点
        for (int x = 1; x <= 11; x++) {
            String starttimeStr = "早上" + getNumber(x) + "点";
            timeEntityMap.put(starttimeStr, TimeEntity.builder()
                    .other(starttimeStr)
                    .timeTemplate(String.format(TIME_TEMPLATE_ONE, 0, x, 0)).build());
        }
        // 早上几点几分
        for (int x = 1; x <= 11; x++) {
            for (int i = 0; i < 60; i++) {
                String starttimeStr = "早上" + getNumber(x) + "点" + getNumber(i) + "分";
                timeEntityMap.put(starttimeStr, TimeEntity.builder()
                        .other(starttimeStr)
                        .timeTemplate(String.format(TIME_TEMPLATE_ONE, 0, x, i)).build());
            }
        }
        // 上午几点
        for (int x = 1; x <= 11; x++) {
            String starttimeStr = "上午" + getNumber(x) + "点";
            timeEntityMap.put(starttimeStr, TimeEntity.builder()
                    .other(starttimeStr)
                    .timeTemplate(String.format(TIME_TEMPLATE_ONE, 0, x, 0)).build());
        }
        // 上午几点几分
        for (int x = 1; x <= 11; x++) {
            for (int i = 0; i < 60; i++) {
                String starttimeStr = "上午" + getNumber(x) + "点" + getNumber(i) + "分";
                timeEntityMap.put(starttimeStr, TimeEntity.builder()
                        .other(starttimeStr)
                        .timeTemplate(String.format(TIME_TEMPLATE_ONE, 0, x, i)).build());
            }
        }
        // 下午几点
        for (int x = 1; x <= 11; x++) {
            String starttimeStr = "下午" + getNumber(x) + "点";
            timeEntityMap.put(starttimeStr, TimeEntity.builder()
                    .other(starttimeStr)
                    .timeTemplate(String.format(TIME_TEMPLATE_ONE, 0, x + 12, 0)).build());
        }
        // 下午几点几分
        for (int x = 1; x <= 11; x++) {
            for (int i = 0; i < 60; i++) {
                String starttimeStr = "下午" + getNumber(x) + "点" + getNumber(i) + "分";
                timeEntityMap.put(starttimeStr, TimeEntity.builder()
                        .other(starttimeStr)
                        .timeTemplate(String.format(TIME_TEMPLATE_ONE, 0, x + 12, i)).build());
            }
        }
        // 今天几点
        for (int x = 1; x <= 23; x++) {
            String starttimeStr = "今天" + getNumber(x) + "点";
            timeEntityMap.put(starttimeStr, TimeEntity.builder()
                    .other(starttimeStr)
                    .timeTemplate(String.format(TIME_TEMPLATE_ONE, 0, x, 0)).build());
        }
        // 今天几点几分
        for (int x = 1; x <= 23; x++) {
            for (int i = 0; i < 60; i++) {
                String starttimeStr = "今天" + getNumber(x) + "点" + getNumber(i) + "分";
                timeEntityMap.put(starttimeStr, TimeEntity.builder()
                        .other(starttimeStr)
                        .timeTemplate(String.format(TIME_TEMPLATE_ONE, 0, x, i)).build());
            }
        }

        // 几点
        for (int x = 1; x <= 23; x++) {
            String starttimeStr = getNumber(x) + "点";
            timeEntityMap.put(starttimeStr, TimeEntity.builder()
                    .other(starttimeStr)
                    .timeTemplate(String.format(TIME_TEMPLATE_ONE, 0, x, 0)).build());
        }
        // 几点几分
        for (int x = 1; x <= 23; x++) {
            for (int i = 0; i < 60; i++) {
                String starttimeStr = getNumber(x) + "点" + getNumber(i) + "分";
                timeEntityMap.put(starttimeStr, TimeEntity.builder()
                        .other(starttimeStr)
                        .timeTemplate(String.format(TIME_TEMPLATE_ONE, 0, x, i)).build());
            }
        }

        return randomMap(timeEntityMap);
    }

    /**
     * 本周
     *
     * @return
     */
    public static Map<String, TimeEntity> T003() {
        Map<String, TimeEntity> timeEntityMap = new HashMap<>();
        List<String> days = Arrays.asList(
                "周一", "周二", "周三", "周四", "周五", "周六", "周日",
                "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日",
                "本周一", "本周二", "本周三", "本周四", "本周五", "本周六", "本周日",
                "礼拜一", "礼拜二", "礼拜三", "礼拜四", "礼拜五", "礼拜六", "礼拜日",
                "周末");

        Map<String, String> dayMap = new HashMap<>();
        dayMap.put("周一", "DayOfWeek.MONDAY");
        dayMap.put("周二", "DayOfWeek.TUESDAY");
        dayMap.put("周三", "DayOfWeek.WEDNESDAY");
        dayMap.put("周四", "DayOfWeek.THURSDAY");
        dayMap.put("周五", "DayOfWeek.FRIDAY");
        dayMap.put("周六", "DayOfWeek.SATURDAY");
        dayMap.put("周日", "DayOfWeek.SUNDAY");

        dayMap.put("星期一", "DayOfWeek.MONDAY");
        dayMap.put("星期二", "DayOfWeek.TUESDAY");
        dayMap.put("星期三", "DayOfWeek.WEDNESDAY");
        dayMap.put("星期四", "DayOfWeek.THURSDAY");
        dayMap.put("星期五", "DayOfWeek.FRIDAY");
        dayMap.put("星期六", "DayOfWeek.SATURDAY");
        dayMap.put("星期日", "DayOfWeek.SUNDAY");

        dayMap.put("本周一", "DayOfWeek.MONDAY");
        dayMap.put("本周二", "DayOfWeek.TUESDAY");
        dayMap.put("本周三", "DayOfWeek.WEDNESDAY");
        dayMap.put("本周四", "DayOfWeek.THURSDAY");
        dayMap.put("本周五", "DayOfWeek.FRIDAY");
        dayMap.put("本周六", "DayOfWeek.SATURDAY");
        dayMap.put("本周日", "DayOfWeek.SUNDAY");

        dayMap.put("礼拜一", "DayOfWeek.MONDAY");
        dayMap.put("礼拜二", "DayOfWeek.TUESDAY");
        dayMap.put("礼拜三", "DayOfWeek.WEDNESDAY");
        dayMap.put("礼拜四", "DayOfWeek.THURSDAY");
        dayMap.put("礼拜五", "DayOfWeek.FRIDAY");
        dayMap.put("礼拜六", "DayOfWeek.SATURDAY");
        dayMap.put("礼拜日", "DayOfWeek.SUNDAY");
        dayMap.put("周末", "DayOfWeek.SUNDAY");

        for (int d = 0; d < days.size(); d++) {
            String day = days.get(d);
            // 星期 + 早上 + 几 + 点
            for (int x = 1; x <= 11; x++) {
                String starttimeStr = day + "早上" + getNumber(x) + "点";
                timeEntityMap.put(starttimeStr,
                        TimeEntity.builder()
                        .other(starttimeStr)
                        .timeTemplate(String.format(TIME_TEMPLATE_TWO, dayMap.get(day), x, 0)).build());
            }
            // 星期 + 早上 + 几 + 点 + 几 + 分
            for (int x = 1; x <= 11; x++) {
                for (int i = 0; i < 60; i++) {
                    String starttimeStr = day + "早上" + getNumber(x) + "点" + getNumber(i) + "分";
                    timeEntityMap.put(starttimeStr,
                            TimeEntity.builder()
                            .other(starttimeStr)
                            .timeTemplate(String.format(TIME_TEMPLATE_TWO, dayMap.get(day), x, i)).build());
                }
            }
            // 星期 + 上午 + 几 + 点
            for (int x = 1; x <= 11; x++) {
                String starttimeStr = day + "上午" + getNumber(x) + "点";
                timeEntityMap.put(starttimeStr,
                        TimeEntity.builder()
                                .other(starttimeStr)
                                .timeTemplate(String.format(TIME_TEMPLATE_TWO, dayMap.get(day), x, 0)).build());
            }
            // 星期 + 上午 + 几 + 点 + 几 + 分
            for (int x = 1; x <= 11; x++) {
                for (int i = 0; i < 60; i++) {
                    String starttimeStr = day + "上午" + getNumber(x) + "点" + getNumber(i) + "分";
                    timeEntityMap.put(starttimeStr,
                            TimeEntity.builder()
                                    .other(starttimeStr)
                                    .timeTemplate(String.format(TIME_TEMPLATE_TWO, dayMap.get(day), x, i)).build());
                }
            }
            // 星期 + 下午 + 几 + 点
            for (int x = 1; x <= 11; x++) {
                String starttimeStr = day + "下午" + getNumber(x) + "点";
                timeEntityMap.put(starttimeStr,
                        TimeEntity.builder()
                                .other(starttimeStr)
                                .timeTemplate(String.format(TIME_TEMPLATE_TWO, dayMap.get(day),  x + 12, 0)).build());
            }
            // 星期 + 下午 + 几 + 点 + 几 + 分
            for (int x = 1; x <= 11; x++) {
                for (int i = 0; i < 60; i++) {
                    String starttimeStr = day + "下午" + getNumber(x) + "点" + getNumber(i) + "分";
                    timeEntityMap.put(starttimeStr,
                            TimeEntity.builder()
                                    .other(starttimeStr)
                                    .timeTemplate(String.format(TIME_TEMPLATE_TWO, dayMap.get(day), x + 12, i)).build());
                }
            }
            // 星期 + 几 + 点
            for (int x = 0; x < 24; x++) {
                String starttimeStr = day + getNumber(x) + "点";
                timeEntityMap.put(starttimeStr,
                        TimeEntity.builder()
                                .other(starttimeStr)
                                .timeTemplate(String.format(TIME_TEMPLATE_TWO, dayMap.get(day),  x, 0)).build());
            }
            // 星期 + 几 + 点 + 几 + 分
            for (int x = 0; x < 24; x++) {
                for (int i = 0; i < 60; i++) {
                    String starttimeStr = day + getNumber(x) + "点" + getNumber(i) + "分";
                    timeEntityMap.put(starttimeStr,
                            TimeEntity.builder()
                                    .other(starttimeStr)
                                    .timeTemplate(String.format(TIME_TEMPLATE_TWO, dayMap.get(day),  x, i)).build());
                }
            }
        }

        return randomMap(timeEntityMap,200);
    }

    /**
     * 下周
     *
     * @return
     */
    public static Map<String, TimeEntity> T004() {
        Map<String, TimeEntity> timeEntityMap = new HashMap<>();
        List<String> days = Arrays.asList(
                "下周一", "下周二", "下周三", "下周四", "下周五", "下周六", "下周日",
                "下周末");

        Map<String, String> dayMap = new HashMap<>();
        dayMap.put("下周一", "DayOfWeek.MONDAY");
        dayMap.put("下周二", "DayOfWeek.TUESDAY");
        dayMap.put("下周三", "DayOfWeek.WEDNESDAY");
        dayMap.put("下周四", "DayOfWeek.THURSDAY");
        dayMap.put("下周五", "DayOfWeek.FRIDAY");
        dayMap.put("下周六", "DayOfWeek.SATURDAY");
        dayMap.put("下周日", "DayOfWeek.SUNDAY");

        dayMap.put("下周末", "DayOfWeek.SUNDAY");

        for (int d = 0; d < days.size(); d++) {
            String day = days.get(d);
            // 下周 + 早上 + 几 + 点
            for (int x = 1; x <= 11; x++) {
                String starttimeStr = day + "早上" + getNumber(x) + "点";
                timeEntityMap.put(starttimeStr,
                        TimeEntity.builder()
                                .other(starttimeStr)
                                .timeTemplate(String.format(TIME_TEMPLATE_THREE, dayMap.get(day), x, 0)).build());
            }
            // 下周 + 早上 + 几 + 点 + 几 + 分
            for (int x = 1; x <= 11; x++) {
                for (int i = 0; i < 60; i++) {
                    String starttimeStr = day + "早上" + getNumber(x) + "点" + getNumber(i) + "分";
                    timeEntityMap.put(starttimeStr,
                            TimeEntity.builder()
                                    .other(starttimeStr)
                                    .timeTemplate(String.format(TIME_TEMPLATE_THREE, dayMap.get(day), x, i)).build());
                }
            }
            // 下周 + 上午 + 几 + 点
            for (int x = 1; x <= 11; x++) {
                String starttimeStr = day + "上午" + getNumber(x) + "点";
                timeEntityMap.put(starttimeStr,
                        TimeEntity.builder()
                                .other(starttimeStr)
                                .timeTemplate(String.format(TIME_TEMPLATE_THREE, dayMap.get(day), x, 0)).build());
            }
            // 星期 + 上午 + 几 + 点 + 几 + 分
            for (int x = 1; x <= 11; x++) {
                for (int i = 0; i < 60; i++) {
                    String starttimeStr = day + "上午" + getNumber(x) + "点" + getNumber(i) + "分";
                    timeEntityMap.put(starttimeStr,
                            TimeEntity.builder()
                                    .other(starttimeStr)
                                    .timeTemplate(String.format(TIME_TEMPLATE_THREE, dayMap.get(day), x, i)).build());
                }
            }
            // 下周 + 下午 + 几 + 点
            for (int x = 1; x <= 11; x++) {
                String starttimeStr = day + "下午" + getNumber(x) + "点";
                timeEntityMap.put(starttimeStr,
                        TimeEntity.builder()
                                .other(starttimeStr)
                                .timeTemplate(String.format(TIME_TEMPLATE_THREE, dayMap.get(day), x + 12, 0)).build());
            }
            // 下周 + 下午 + 几 + 点 + 几 + 分
            for (int x = 1; x <= 11; x++) {
                for (int i = 0; i < 60; i++) {
                    String starttimeStr = day + "下午" + getNumber(x) + "点" + getNumber(i) + "分";
                    timeEntityMap.put(starttimeStr,
                            TimeEntity.builder()
                                    .other(starttimeStr)
                                    .timeTemplate(String.format(TIME_TEMPLATE_THREE, dayMap.get(day), x + 12, i)).build());
                }
            }
            // 下周 + 几 + 点
            for (int x = 0; x < 24; x++) {
                String starttimeStr = day + getNumber(x) + "点";
                timeEntityMap.put(starttimeStr,
                        TimeEntity.builder()
                                .other(starttimeStr)
                                .timeTemplate(String.format(TIME_TEMPLATE_THREE, dayMap.get(day), x, 0)).build());
            }
            // 下周 + 几 + 点 + 几 + 分
            for (int x = 0; x < 24; x++) {
                for (int i = 0; i < 60; i++) {
                    String starttimeStr = day + x + "点" + getNumber(i) + "分";
                    timeEntityMap.put(starttimeStr,
                            TimeEntity.builder()
                                    .other(starttimeStr)
                                    .timeTemplate(String.format(TIME_TEMPLATE_THREE, dayMap.get(day), x, i)).build());
                }
            }
        }

        return randomMap(timeEntityMap,100);
    }


    //几月几日 | 几月几号 | 1月13 | 23年1月5日 ； 几点
    public static Map<String, TimeEntity> T005() {
        Map<String, TimeEntity> timeEntityMap = new HashMap<>();
        for (int month = 0; month < 12; month++) {
            for (int day = 0; day < 30; day++) {
                String strTemplate = "%s月%s日";
                TimeEntity timeEntity = TimeEntity.builder()
                        .other(String.format(strTemplate, TimeDataConstant.CHINESE_100[month], TimeDataConstant.CHINESE_100[day]))
                        .timeTemplate("LocalDateTime.now().toLocalDate().withMonth(" + TimeDataConstant.NUMBER_100[month] + ").withDayOfMonth(" + TimeDataConstant.NUMBER_100[day] + ").atTime(0,0);")
                        .build();
                timeEntityMap.put(timeEntity.getOther(), timeEntity);
            }
        }

        for (int month = 0; month < 12; month++) {
            for (int day = 0; day < 30; day++) {
                String strTemplate = "%s月%s日";
                TimeEntity timeEntity = TimeEntity.builder()
                        .other(String.format(strTemplate, TimeDataConstant.CHINESE_100[month], TimeDataConstant.NUMBER_100[day]))
                        .timeTemplate("LocalDateTime.now().toLocalDate().withMonth(" + TimeDataConstant.NUMBER_100[month] + ").withDayOfMonth(" + TimeDataConstant.NUMBER_100[day] + ").atTime(0,0);")
                        .build();
                timeEntityMap.put(timeEntity.getOther(), timeEntity);
            }
        }

        for (int month = 0; month < 12; month++) {
            for (int day = 0; day < 30; day++) {
                String strTemplate = "%s月%s日";
                TimeEntity timeEntity = TimeEntity.builder()
                        .other(String.format(strTemplate, TimeDataConstant.NUMBER_100[month], TimeDataConstant.NUMBER_100[day]))
                        .timeTemplate("LocalDateTime.now().toLocalDate().withMonth(" + TimeDataConstant.NUMBER_100[month] + ").withDayOfMonth(" + TimeDataConstant.NUMBER_100[day] + ").atTime(0,0);")
                        .build();
                timeEntityMap.put(timeEntity.getOther(), timeEntity);
            }
        }

        for (int month = 0; month < 12; month++) {
            for (int day = 0; day < 30; day++) {
                String strTemplate = "%s月%s号";
                TimeEntity timeEntity = TimeEntity.builder()
                        .other(String.format(strTemplate, TimeDataConstant.NUMBER_100[month], TimeDataConstant.CHINESE_100[day]))
                        .timeTemplate("LocalDateTime.now().toLocalDate().withMonth(" + TimeDataConstant.NUMBER_100[month] + ").withDayOfMonth(" + TimeDataConstant.NUMBER_100[day] + ").atTime(0,0);")
                        .build();
                timeEntityMap.put(timeEntity.getOther(), timeEntity);
            }
        }

        return randomMap(timeEntityMap);
    }

    public static Map<String, TimeEntity> T006() {
        Map<String, TimeEntity> timeEntityMap = new HashMap<>();
        for (int month = 0; month < 12; month++) {
            for (int day = 0; day < 30; day++) {
                String strTemplate = "%s月%s号";
                TimeEntity timeEntity = TimeEntity.builder()
                        .other(String.format(strTemplate, TimeDataConstant.CHINESE_100[month], TimeDataConstant.CHINESE_100[day]))
                        .timeTemplate("LocalDateTime.now().toLocalDate().withMonth(" + TimeDataConstant.NUMBER_100[month] + ").withDayOfMonth(" + TimeDataConstant.NUMBER_100[day] + ").atTime(0,0);")
                        .build();
                timeEntityMap.put(timeEntity.getOther(), timeEntity);
            }
        }

        for (int month = 0; month < 12; month++) {
            for (int day = 0; day < 30; day++) {
                String strTemplate = "%s月%s号";
                TimeEntity timeEntity = TimeEntity.builder()
                        .other(String.format(strTemplate, TimeDataConstant.CHINESE_100[month], TimeDataConstant.NUMBER_100[day]))
                        .timeTemplate("LocalDateTime.now().toLocalDate().withMonth(" + TimeDataConstant.NUMBER_100[month] + ").withDayOfMonth(" + TimeDataConstant.NUMBER_100[day] + ").atTime(0,0);")
                        .build();
                timeEntityMap.put(timeEntity.getOther(), timeEntity);
            }
        }

        for (int month = 0; month < 12; month++) {
            for (int day = 0; day < 30; day++) {
                String strTemplate = "%s月%s号";
                TimeEntity timeEntity = TimeEntity.builder()
                        .other(String.format(strTemplate, TimeDataConstant.NUMBER_100[month], TimeDataConstant.NUMBER_100[day]))
                        .timeTemplate("LocalDateTime.now().toLocalDate().withMonth(" + TimeDataConstant.NUMBER_100[month] + ").withDayOfMonth(" + TimeDataConstant.NUMBER_100[day] + ").atTime(0,0);")
                        .build();
                timeEntityMap.put(timeEntity.getOther(), timeEntity);
            }
        }

        for (int month = 0; month < 12; month++) {
            for (int day = 0; day < 30; day++) {
                String strTemplate = "%s月%s号";
                TimeEntity timeEntity = TimeEntity.builder()
                        .other(String.format(strTemplate, TimeDataConstant.NUMBER_100[month], TimeDataConstant.CHINESE_100[day]))
                        .timeTemplate("LocalDateTime.now().toLocalDate().withMonth(" + TimeDataConstant.NUMBER_100[month] + ").withDayOfMonth(" + TimeDataConstant.NUMBER_100[day] + ").atTime(0,0);")
                        .build();
                timeEntityMap.put(timeEntity.getOther(), timeEntity);
            }
        }

        return randomMap(timeEntityMap);
    }

    public static Map<String, TimeEntity> T007() {
        Map<String, TimeEntity> timeEntityMap = new HashMap<>();
        for (int month = 0; month < 12; month++) {
            for (int day = 0; day < 30; day++) {
                String strTemplate = "%s月%s";
                TimeEntity timeEntity = TimeEntity.builder()
                        .other(String.format(strTemplate, TimeDataConstant.CHINESE_100[month], TimeDataConstant.CHINESE_100[day]))
                        .timeTemplate("LocalDateTime.now().toLocalDate().withMonth(" + TimeDataConstant.NUMBER_100[month] + ").withDayOfMonth(" + TimeDataConstant.NUMBER_100[day] + ").atTime(0,0);")
                        .build();
                timeEntityMap.put(timeEntity.getOther(), timeEntity);
            }
        }

        for (int month = 0; month < 12; month++) {
            for (int day = 0; day < 30; day++) {
                String strTemplate = "%s月%s";
                TimeEntity timeEntity = TimeEntity.builder()
                        .other(String.format(strTemplate, TimeDataConstant.CHINESE_100[month], TimeDataConstant.NUMBER_100[day]))
                        .timeTemplate("LocalDateTime.now().toLocalDate().withMonth(" + TimeDataConstant.NUMBER_100[month] + ").withDayOfMonth(" + TimeDataConstant.NUMBER_100[day] + ").atTime(0,0);")
                        .build();
                timeEntityMap.put(timeEntity.getOther(), timeEntity);
            }
        }

        for (int month = 0; month < 12; month++) {
            for (int day = 0; day < 30; day++) {
                String strTemplate = "%s月%s";
                TimeEntity timeEntity = TimeEntity.builder()
                        .other(String.format(strTemplate, TimeDataConstant.NUMBER_100[month], TimeDataConstant.NUMBER_100[day]))
                        .timeTemplate("LocalDateTime.now().toLocalDate().withMonth(" + TimeDataConstant.NUMBER_100[month] + ").withDayOfMonth(" + TimeDataConstant.NUMBER_100[day] + ").atTime(0,0);")
                        .build();
                timeEntityMap.put(timeEntity.getOther(), timeEntity);
            }
        }

        for (int month = 0; month < 12; month++) {
            for (int day = 0; day < 30; day++) {
                String strTemplate = "%s月%s";
                TimeEntity timeEntity = TimeEntity.builder()
                        .other(String.format(strTemplate, TimeDataConstant.NUMBER_100[month], TimeDataConstant.CHINESE_100[day]))
                        .timeTemplate("LocalDateTime.now().toLocalDate().withMonth(" + TimeDataConstant.NUMBER_100[month] + ").withDayOfMonth(" + TimeDataConstant.NUMBER_100[day] + ").atTime(0,0);")
                        .build();
                timeEntityMap.put(timeEntity.getOther(), timeEntity);
            }
        }

        return randomMap(timeEntityMap);
    }


    public static Map<String, TimeEntity> T008() {
        Map<String, TimeEntity> timeEntityMap = new HashMap<>();
        for (int year = 2023; year < 2030; year++) {
            for (int month = 0; month < 12; month++) {
                for (int day = 0; day < 30; day++) {
                    String strTemplate = "%s年%s月%s日";
                    TimeEntity timeEntity = TimeEntity.builder()
                            .other(String.format(strTemplate, year, TimeDataConstant.NUMBER_100[month], TimeDataConstant.NUMBER_100[day]))
                            .timeTemplate("LocalDateTime.now().toLocalDate().withYear(" + year + ").withMonth(" + TimeDataConstant.NUMBER_100[month] + ").withDayOfMonth(" + TimeDataConstant.NUMBER_100[day] + ").atTime(0,0);")
                            .build();
                    timeEntityMap.put(timeEntity.getOther(), timeEntity);
                }
            }
        }

        return randomMap(timeEntityMap);
    }


    public static Map<String, TimeEntity> T009() {
        Map<String, TimeEntity> timeEntityMap = new HashMap<>();
        for (int hour = 0; hour < 24; hour++) {
            String strTemplate = "%s点";
            TimeEntity timeEntity = TimeEntity.builder()
                    .other(String.format(strTemplate, TimeDataConstant.NUMBER_100[hour]))
                    .timeTemplate("LocalDateTime.now().toLocalDate().atTime(" + TimeDataConstant.NUMBER_100[hour] + ",0);")
                    .build();
            timeEntityMap.put(timeEntity.getOther(), timeEntity);
        }

        return randomMap(timeEntityMap);
    }




    public static Map<String, TimeEntity> T0010() {Map<String, TimeEntity> timeEntityMap = new HashMap<>();

        // 早上 + 几 + 点
        for (int x = 1; x <= 11; x++) {
            String starttimeStr = "早上" + getNumber(x) + "点";
            timeEntityMap.put(starttimeStr,
                    TimeEntity.builder()
                            .other(starttimeStr)
                            .timeTemplate(String.format(TIME_TEMPLATE_ONE, 0, x, 0)).build());
        }
        // 早上 + 几 + 点 + 几 + 分
        for (int x = 1; x <= 11; x++) {
            for (int i = 0; i < 60; i++) {
                String starttimeStr = "早上" + getNumber(x) + "点" + getNumber(i) + "分";
                timeEntityMap.put(starttimeStr,
                        TimeEntity.builder()
                                .other(starttimeStr)
                                .timeTemplate(String.format(TIME_TEMPLATE_ONE, 0, x, i)).build());
            }
        }
        // 星期 + 上午 + 几 + 点
        for (int x = 1; x <= 11; x++) {
            String starttimeStr = "上午" + getNumber(x) + "点";
            timeEntityMap.put(starttimeStr,
                    TimeEntity.builder()
                            .other(starttimeStr)
                            .timeTemplate(String.format(TIME_TEMPLATE_ONE, 0, x, 0)).build());
        }
        // 星期 + 上午 + 几 + 点 + 几 + 分
        for (int x = 1; x <= 11; x++) {
            for (int i = 0; i < 60; i++) {
                String starttimeStr = "上午" + getNumber(x) + "点" + getNumber(i) + "分";
                timeEntityMap.put(starttimeStr,
                        TimeEntity.builder()
                                .other(starttimeStr)
                                .timeTemplate(String.format(TIME_TEMPLATE_ONE, 0, x, i)).build());
            }
        }
        // 星期 + 下午 + 几 + 点
        for (int x = 1; x <= 11; x++) {
            String starttimeStr = "下午" + getNumber(x) + "点";
            timeEntityMap.put(starttimeStr,
                    TimeEntity.builder()
                            .other(starttimeStr)
                            .timeTemplate(String.format(TIME_TEMPLATE_ONE, 0, x + 12, 0)).build());
        }
        // 星期 + 下午 + 几 + 点 + 几 + 分
        for (int x = 1; x <= 11; x++) {
            for (int i = 0; i < 60; i++) {
                String starttimeStr = "下午" + getNumber(x) + "点" + getNumber(i) + "分";
                timeEntityMap.put(starttimeStr,
                        TimeEntity.builder()
                                .other(starttimeStr)
                                .timeTemplate(String.format(TIME_TEMPLATE_ONE, 0, x + 12, i)).build());
            }
        }
        return randomMap(timeEntityMap);
    }


    public static Map<String, TimeEntity> T0011() {
        Map<String, TimeEntity> timeEntityMap = new HashMap<>();
        for (int hour = 0; hour < 10; hour++) {
            String strTemplate = "%s小时后";
            TimeEntity timeEntity = TimeEntity.builder()
                    .other(String.format(strTemplate, TimeDataConstant.NUMBER_100[hour]))
                    .timeTemplate("LocalDateTime.now().plusHours(" + TimeDataConstant.NUMBER_100[hour] + ");")
                    .build();
            timeEntityMap.put(timeEntity.getOther(), timeEntity);
        }

        for (int hour = 0; hour < 10; hour++) {
            String strTemplate = "%s小时之后";
            TimeEntity timeEntity = TimeEntity.builder()
                    .other(String.format(strTemplate, TimeDataConstant.NUMBER_100[hour]))
                    .timeTemplate("LocalDateTime.now().plusHours(" + TimeDataConstant.NUMBER_100[hour] + ");")
                    .build();
            timeEntityMap.put(timeEntity.getOther(), timeEntity);
        }

        return randomMap(timeEntityMap);
    }

    public static Map<String, TimeEntity> randomMap(Map<String, TimeEntity> timeEntityMap) {
        System.out.print("randomSize startSize=" + timeEntityMap.size());
        List<String> keys = new ArrayList<>(timeEntityMap.keySet());
        if (keys.size() > 100) {
            Map<String, TimeEntity> newMap = new HashMap<>();
            for (int i = 0; i < 100; i++) {
                String key = keys.get(RandomUtil.randomInt(0, keys.size()));
                newMap.put(key, timeEntityMap.get(key));
            }
            System.out.println(" endSize=" + newMap.size());
            return newMap;
        }
        System.out.println(" endSize=" + timeEntityMap.size());
        return timeEntityMap;
    }

    public static Map<String, TimeEntity> randomMap(Map<String, TimeEntity> timeEntityMap,Integer size) {
        System.out.print("randomSize startSize=" + timeEntityMap.size());
        List<String> keys = new ArrayList<>(timeEntityMap.keySet());
        if (keys.size() > size) {
            Map<String, TimeEntity> newMap = new HashMap<>();
            for (int i = 0; i < size; i++) {
                String key = keys.get(RandomUtil.randomInt(0, keys.size()));
                newMap.put(key, timeEntityMap.get(key));
            }
            System.out.println(" endSize=" + newMap.size());
            return newMap;
        }
        System.out.println(" endSize=" + timeEntityMap.size());
        return timeEntityMap;
    }


    private static String getNumber(Integer number) {
        int minStr = RandomUtil.randomInt(0, 2);
        if (minStr == 1) {
            return TimeDataConstant.CHINESE_100_SERIAL[number];
        } else {
            return TimeDataConstant.NUMBER_100_SERIAL[number];
        }
    }


}
